/* * Copyright (c) 2016, S.F. Express Inc. All rights reserved. */ package com.sf.osms.dep.dao.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.hibernate.SQLQuery;
import org.springframework.stereotype.Repository;

import com.sf.novatar.base.dao.BaseBeanDao;
import com.sf.osms.dep.dao.IChargeBaseDao;
import com.sf.osms.dep.domain.ChargeBase;
import com.sf.osms.dep.processor.util.CollectionUtil;
/** * 描述：
 *  @author 841245 
 * @since 1.0 
 * */

@Repository
public class ChargeBaseDaoImpl extends BaseBeanDao<Long,ChargeBase> implements IChargeBaseDao {

	
	@Override
	public Map<String, ChargeBase> queryPodHandOverData(Set<String> sfWaybills) {
		 Map<String, ChargeBase> map = new HashMap<String, ChargeBase>();
		 if(CollectionUtil.isEmpty(sfWaybills)){
			 return map;
		 }
		String ids = "";
		for (String string : sfWaybills) {
			ids = ids +"," + "\'" + string + "\'";
		}
		ids = ids.substring(ids.indexOf(",")+1);
		
 		String sql = "select * from wbs_tt_charge_base where sfWaybill in ("+ids+")";
 		SQLQuery query = getCurrentSession().createSQLQuery(sql);
	  
	  
	    List<ChargeBase> list = query.addEntity(ChargeBase.class).list();
	    if(!CollectionUtil.isEmpty(list)){
	    	for (ChargeBase chargeBase : list) {
				map.put(chargeBase.getSfWaybill(), chargeBase);
			}
	    }
	    
		return map;
	}
	
	
	
	

}
